import request from "@sc/request";
import { stringify } from 'qs';
//---------------------------组织树
export async function getOrganizTree(params) {//获取组织树
  // console.log('param------>', params);
  return request(`/api/v1/ucenter/org/selectOrgTreeByOrgId?${stringify(params)}`, {
    method: 'GET',
  });
}
export async function addOrganizTree(params) {//新增组织树
  return request(`/api/v1/ucenter/org/save`, {
    method: 'POST',
    data: params//stringify(params)
  });
}
export async function searchOrganizTree(params) {//查询某个组织
  return request(`/api/v1/ucenter/org/select?${stringify(params)}`, {
    method: 'GET',
  });
}
export async function editOrganizTree(params) {//编辑组织树
  return request(`/api/v1/ucenter/org/update`, {
    method: 'POST',
    data: params
  });
}
export async function deleteOrganizTree(params) {//删除组织树
  return request(`/api/v1/ucenter/org/delete?${stringify(params)}`, {
    method: 'POST',
    data: params
  });
}
export async function getFileDownloadUrl(params) {//获取文件地址
  return request(`/api/v1/ucenter/getFileDownloadUrl`, {
    method: 'POST',
    data: params
  })
}
//----------------------组织内的公司
export async function joinCompany(params) {
  return request(`/api/v1/ucenter/org/joinOrgApplySave`, {
    method: 'POST',
    data: params
  });
}
export async function getOrgCompany(params) {
  return request(`/api/v1/ucenter/company/selectListByOrgId`, {
    method: 'POST',
    data: params
  });
}
//----------------------------权限----
// export async function getRolesByOrgId(params) {//根据ORG查询角色权限列表
//   return request(`/api/v1/ucenter/role/getRolesByOrgId?${stringify(params)}`, {
//     method: 'GET',
//   })
// }
export async function getRoleList(params) {//分页查询角色
  return request(`/api/v1/ucenter/role/page?${stringify(params)}`, {
    method: 'GET',
  })
}
export async function getResourcesTree(params) {//分页查询角色
  return request(`/api/v1/ucenter/role/getResourcesForRole?${stringify(params)}`, {
    method: 'GET',
  })
}
export async function addRole(params) {//新增角色
  return request(`/api/v1/ucenter/role/add`, {
    method: 'POST',
    data: params
  });
}
export async function getRoleInfoById(params) {//根据角色id查询单个角色信息---------编辑角色
  return request(`/api/v1/ucenter/role/get?${stringify(params)}`, {
    method: 'GET',
  });
}
export async function editRole(params) {//编辑角色
  return request(`/api/v1/ucenter/role/modify`, {
    method: 'POST',
    data: params
  });
}
export async function deleteRole(params) {//根据ID删除角色
  return request(`/api/v1/ucenter/role/delete?${stringify(params)}`, {
    method: 'POST',
    data: params
  });
}